package com.ams.entity;

import java.io.Serializable;
import java.util.Set;

public class Permi implements Comparable<Permi>,Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7165146124927630557L;


	private int permiId;
	
	
	private Set<Role> roles;
	
	
	private Permi parent;
	
	
	private Set<Permi> childPermis;
	
	private String permiName,url;
	
	public Permi(){}

	public int getPermiId() {
		return permiId;
	}

	public void setPermiId(int permiId) {
		this.permiId = permiId;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public Permi getParent() {
		return parent;
	}

	public void setParent(Permi parent) {
		this.parent = parent;
	}

	public Set<Permi> getChildPermis() {
		return childPermis;
	}

	public void setChildPermis(Set<Permi> childPermis) {
		this.childPermis = childPermis;
	}

	public String getPermiName() {
		return permiName;
	}

	public void setPermiName(String permiName) {
		this.permiName = permiName;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public int compareTo(Permi per) {
		if(per==null){
			return 1;
		}
		
		return permiId-per.getPermiId();
	}

	@Override
	public int hashCode() {
		return permiName.hashCode()*25;
	}

	@Override
	public boolean equals(Object obj) {
		return permiName.equals(obj);
	}
	
	public String toString(){
		return permiName;
	}
	
}
